package org.springframework.core.annotation;

import java.lang.annotation.Annotation;
import java.lang.reflect.AnnotatedElement;
import java.util.Arrays;

public class AnnotationUtils {

    static Annotation[] getDeclaredAnnotations(AnnotatedElement annotatedElement) {
        Annotation[] declaredAnnotations = annotatedElement.getDeclaredAnnotations();
        return Arrays.stream(declaredAnnotations).filter(annotation -> {
            if (AnnotationFilter.PLAIN.matches(annotation)) {
                return false;
            }

            return true;
        }).toArray(Annotation[]::new);
    }
}
